package com.lglbc.factory.simple;

import com.lglbc.factory.entity.Car;

import java.util.Objects;
import java.util.Scanner;
/**
 * @author： 乐哥聊编程(全平台同号)
 */
public class Test {
    public static void main(String[] args) {
        SimpleFactory simpleFactory = new SimpleFactory();
        while (true){
            System.out.println("请问需要什么颜色的汽车？yellow or black?");
            Scanner input=new Scanner(System.in);
            String color=input.next();//读取输入的字符串
            Car car = simpleFactory.createCar(color);
            if (Objects.nonNull(car)){
                car.carColor();
                car.carSpeed();
                car.carPrice();
            }
        }
    }
}